package com.haoxi.gateway.cngpmsg;

public class CNGPLoginRespMessage extends CNGPMessage {

    public CNGPLoginRespMessage(byte buf[]) throws IllegalArgumentException {
        super.buf = new byte[33];
        if (buf.length != 33) {
            throw new IllegalArgumentException(
                    "The message that is sent by SMC is wrong");
        } else {
            System.arraycopy(buf, 0, super.buf, 0, buf.length);
            return;
        }
    }

    public byte[] getAuthenticatorServer() {
        byte tmpbuf[] = new byte[16];
        System.arraycopy(buf, 16, tmpbuf, 0, 16);
        return tmpbuf;
    }

    public byte getVersion() {
        return buf[32];
    }

    public String toString() {
        StringBuffer strBuf = new StringBuffer();
        strBuf.append("CNGPLoginRespMessage: ");
        strBuf.append("PacketLength=").append(buf.length);
        strBuf.append(",RequestID=").append(getRequestId());
        strBuf.append(",Status=").append(getStatus());
        strBuf.append(",SequenceId=").append(getSequenceId());
        strBuf.append(",AuthenticatorServer=").append(getAuthenticatorServer());
        strBuf.append(",Version=").append(getVersion());
        return strBuf.toString();
    }
}
